﻿using System;
using System.Net;
using System.Runtime.Serialization;

namespace Toybox.NicoSharp.Live.LiveGuide
{
	using Extensions;
	using Utilities;

	/// <summary>
	/// ZeroTimeLine クラス
	/// </summary>
	[DataContract]
	public partial class ZeroTimeLine
	{

		#region [Static]

		/// <summary>
		/// ZeroTimeLine 取得
		/// </summary>
		/// <param name="date"></param>
		/// <param name="cookies"></param>
		/// <returns></returns>
		public static ZeroTimeLine Get(DateTime date, CookieCollection cookies = null)
		{
			string url = NicoUrls.LiveApi + "getZeroTimeline?date=" + date.ToString("yyyy-MM-dd");
			string json = NicoWebClient.Get(url, cookies.Coerce());
			return Deserializer.JsonDeserializer<ZeroTimeLine>(json);
		}

		#endregion [Static]


		#region Public Members

		/// <summary>
		/// TimeLine情報
		/// </summary>
		[DataMember]
		public TimeLine timeline;

		#endregion Public Members


		#region [SubClass]

		/// <summary>
		/// TimeLine クラス
		/// </summary>
		[DataContract]
		public class TimeLine
		{
			/// <summary>
			/// 日時
			/// </summary>
			[DataMember]
			public string date;

			/// <summary>
			/// 番組リスト
			/// </summary>
			[DataMember]
			public Stream[] stream_list;
		}

		#endregion [SubClass]

	}
}
